package com.designoutput.ui.options
{
	import com.designoutput.elements.BaseElement;
	import com.designoutput.elements.BaseRectElement;
	import com.designoutput.ui.Card;
	import com.designoutput.ui.controls.Dropdown;
	import com.designoutput.ui.options.components.DepthGroup;
	import com.designoutput.ui.options.components.ElementBaseInfo;
	import com.designoutput.utils.Unit;
	import com.designoutput.utils.UnitUtils;
	
	import flash.display.Sprite;

	public class BaseOption extends Sprite
	{
		public var designOutputCard:DesignoutputCard;
		public var card:Card;
		
		public var elementBaseInfor:ElementBaseInfo;
		public var depthManager:DepthGroup;
				
		public function BaseOption(parent:DesignoutputCard)
		{
			this.designOutputCard = parent;
			this.card = parent.card;
			
			depthManager = new DepthGroup(this); 
			elementBaseInfor = new ElementBaseInfo(this);
			
			elementBaseInfor.x = 0;
			elementBaseInfor.y = 0;
			this.addChild(elementBaseInfor);
			
		}
		
		/**
		 * Update elements information(x,y,w,h).
		 * <LI>for common card, the layer is 3 size of the card size, and the card is on the middle and center of layer</LI> 
		 * <LI>for T-Shirt card, on only Shirt view and only Sleeves view, the card and layer same to above</LI>
		 * <LI>for T-Shirt card, on both Shirt and Sleeves view, the card has the same size with layer.</LI>
		 * @param element
		 * @param bothShirtAndSleeves
		 * @param forSleeveElements
		 * 
		 */		
		public function updateBaseInfor(element:BaseElement,bothShirtAndSleeves:Boolean = false, forSleeveElements:Boolean = false):void {
			this.elementBaseInfor.setBaseInfor(
				UnitUtils.convert(element.x, Unit.PIXELS, card.unit),
				UnitUtils.convert(element.y, Unit.PIXELS,  card.unit),
				UnitUtils.convert(element.width, Unit.PIXELS,  card.unit),
				UnitUtils.convert(element.height, Unit.PIXELS,  card.unit),
				element.skewX,
				element.skewY
			);
		}
	}
}